package cn.jsj.dispose;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 修改案件信息处理类
 * @author LI
 *
 */
public class ModifyCaseInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		cn.jsj.utils.SysLogger.PrintInfo("案件信息修改类");

		//获取参数
		cn.jsj.utils.SysLogger.PrintInfo("canshu-------->"+request.getParameter("courtday")+"   "+request.getParameter("caseconsigner") );

		//新建案件信息对象
		cn.jsj.pojo.TblCaseInfo tci=new cn.jsj.pojo.TblCaseInfo();

		//赋值
		tci.setAffairCause(request.getParameter("affaircause").trim());
		tci.setArchiveDeposit(Integer.parseInt(request.getParameter("archivedeposit").trim()));
		tci.setCaseBill(Integer.parseInt(request.getParameter("casebill").trim()));
		tci.setCaseConsigner(request.getParameter("caseconsigner"));
		tci.setCaseMoney(Integer.parseInt(request.getParameter("casemoney").trim()));
		tci.setCasePayStatus(request.getParameter("casepaystatus"));
		//获得案件类别编号
		cn.jsj.dao.TblUtilsDAO tud=new cn.jsj.dao.TblUtilsDAO();
		tci.setCaseType(tud.getCaseTypeNumb(request.getParameter("casetype").trim()));
		//获得案件性质编号
		tci.setCaseProperty(tud.getCasePropertyNumb(request.getParameter("caseproperty").trim()));
		tci.setCaser_roy_money(Integer.parseInt(request.getParameter("caser_roy_money")));
		tci.setCaseRemark(request.getParameter("caseremark").trim());
		tci.setCaseSignTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("casesigntime").trim()));
		tci.setCheckOffLetter(request.getParameter("checkoffletter").trim());
		tci.setContractNumber(request.getParameter("contractnumber").trim());
		tci.setContractText(Integer.parseInt(request.getParameter("contracttext").trim()));
		tci.setCourtDay(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("courtday").trim()));
		tci.setCourtOffLetter(request.getParameter("courtoffletter").trim());
		tci.setDeleteLabel(0);
		tci.setGatherPerson(request.getParameter("gatherperson").trim());
		tci.setIdentityNumber(request.getParameter("identitynumber").trim());
		tci.setInterviewLetter(request.getParameter("interviewletter").trim());
		tci.setIntroLetter(request.getParameter("introletter").trim());
		tci.setLawyersLetter(request.getParameter("lawyersletter").trim());
		tci.setLetterAuthor(Integer.parseInt(request.getParameter("letterauthor").trim()));
		tci.setOppositeParty(request.getParameter("oppositeparty").trim());
		tci.setOtherText(request.getParameter("othertext").trim());
		tci.setPhoneNumber(request.getParameter("phonenumber").trim());
		tci.setSettleLawsuit(Integer.parseInt(request.getParameter("settlelawsuit").trim()));
		tci.setPayStatusBrief(request.getParameter("casepaystatusbreif").trim());
		tci.setUndertakeBrief(request.getParameter("undertakelawyerbrief").trim());
		//根据律师姓名获得律师id
		cn.jsj.dao.TblLawyerDAO tld=new cn.jsj.dao.TblLawyerDAO();
		tci.setUndertakeLawyer(tld.getLawyerId(request.getParameter("undertakelawyer").trim()));

		//调试信息
		cn.jsj.utils.SysLogger.PrintInfo("赋值完成！！！");
		//保存修改后的案件信息
		cn.jsj.dao.TblCaseInfoDAO tcid=new cn.jsj.dao.TblCaseInfoDAO();
		int saveResult=tcid.saveCaseInfo(tci);

		// 调试信息
		cn.jsj.utils.SysLogger.PrintInfo("修改案件信息结果--------------->"+saveResult);
		//输出流
		java.io.PrintWriter out=response.getWriter();

		//如果保存成功
		 if(saveResult==1){
			 out.println("{message:'修改成功'}");
		 }
		 else{
			 out.println("{message:'修改失败'}");
		 }
		 out.flush();
		 out.close();
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}
}